<?php $this->load->library('urlutility');?>
<style>
li {
	list-style:disc!important;
}
li img.active {
	box-shadow:0 0 10px #fff;
}
ul {
width:<?php echo (92*count($banner))+10 ?>px;
}
</style>
<div class="mgb40 h380 dis_blk" id="boxbannerslide">
  <?php if(count($listbanner)>0){
			foreach($listbanner as $k=>$list){?>
  <img width="886" height="380" class="fl pst_relative" style="float:left;" id="imgbigslide<?php echo $k ?>" src="<?php echo base_url(); ?>uploads/hotelbanner/<?php echo $list['avatar']; ?>">
  <?php }
		}?>
  <div class="item mgt-73 h62"> <a href="javascript:void(0);" id="leftclick" onclick="leftclick(<?php echo count($listbanner) ?>)" style="width:20px;height:100%;background:url(<?php echo base_url(); ?>public/images/Scroll%20Icon-04.png) center center no-repeat;" class="fl pst_relative mgr-20 mgt5">&nbsp;</a>
    <div class="fl w845 pst_relative ov_fl_hidden mgl20">
      <ul class="fl ov_fl_hidden pst_relative zindex11 pdt10 h62" id="boximgsmall">
        <?php if(count($listbanner)>0){
			foreach($listbanner as $k=>$list){?>
        <li style="list-style:none!important;" class="fl"> <img width="71" id="imgsmallslide<?php echo $k ?>" onclick="slidebannerhotel(<?php echo $k ?>,<?php echo count($listbanner) ?>);" height="55" class="fl mgl21 mgb10 <?php if($k==0) echo "active";?>" src="<?php echo base_url(); ?>uploads/hotelbanner/<?php echo $list['avatar']; ?>"></li>
        <?php }
		}?>
      </ul>
    </div>
    <a href="javascript:void(0);" id="rightclick" onclick="rightclick(<?php echo count($listbanner) ?>);" style="width:20px;height:100%;background:url(<?php echo base_url(); ?>public/images/Scroll%20Icon-04.png) center center no-repeat;" class="fr pst_relative tran_180deg mgt5">&nbsp;</a> </div>
</div>
<script>
	var total=<?php echo count($listbanner) ?>;
	$(document).ready(function(){
		$('#boximgsmall').animate({width:92*i+'px'});
		for(var i=1;i<total;i++){
			$("#imgbigslide"+i).css({display:'none'}).animate({marginTop: '-380px',opacity:0});	
			$("#imgsmallslide"+i).addClass('opa05 cursor_poiter');
		}		
		if(total<=8){
			$('#rightclick').hide();
			$('#leftclick').hide();
		}
	});
	var oldi=0;
	var num=0;
	function slidebannerhotel(numberimg,totalimg){
		for(var i=0;i<totalimg;i++){			
			if(i==numberimg){
				$('#imgsmallslide'+numberimg).removeClass('opa05 cursor_poiter',1000).addClass('active');
				$('#imgbigslide'+numberimg).css({display:'block'}).animate({opacity:1},1000);
			}else if(i==oldi){
				$('#imgsmallslide'+oldi).removeClass('active').addClass('opa05 cursor_poiter',1000);	
				$('#imgbigslide'+oldi).animate({opacity:0},1000);
			}		
		}
		oldi=numberimg;
	}
	function rightclick(totalimg){
		if(oldi>=0 && oldi<=7){
			$('#imgsmallslide'+(oldi+1)).removeClass('opa05 cursor_poiter',1000).addClass('active');
			$('#imgbigslide'+(oldi+1)).css({display:'block'}).animate({opacity:1},1000);
			$('#imgsmallslide'+oldi).removeClass('active').addClass('opa05 cursor_poiter',1000);	
			$('#imgbigslide'+oldi).animate({opacity:0},1000);			
		}else if(oldi>=8 && oldi<=totalimg){
			$('#imgsmallslide'+(oldi+1)).removeClass('opa05 cursor_poiter',1000).addClass('active');
			$('#imgbigslide'+(oldi+1)).css({display:'block'}).animate({opacity:1},1000);
			$('#imgsmallslide'+oldi).removeClass('active').addClass('opa05 cursor_poiter',1000);	
			$('#imgbigslide'+oldi).animate({opacity:0},1000);	
			if(oldi>=totalimg-2) $('#rightclick').hide();
			$('#boximgsmall').animate({left:'-=92px'});	
			$('#leftclick').show();
		}
		oldi=oldi+1;	
	}
	function leftclick(totalimg){
		if(oldi<totalimg & oldi>totalimg-9){
			$('#imgsmallslide'+(oldi-1)).removeClass('opa05 cursor_poiter',1000).addClass('active');
			$('#imgbigslide'+(oldi-1)).css({display:'block'}).animate({opacity:1},1000);
			$('#imgsmallslide'+oldi).removeClass('active').addClass('opa05 cursor_poiter',1000);	
			$('#imgbigslide'+oldi).animate({opacity:0},1000);	
		}else if(oldi>=1 && oldi<=totalimg-9){
			$('#imgsmallslide'+(oldi-1)).removeClass('opa05 cursor_poiter',1000).addClass('active');
			$('#imgbigslide'+(oldi-1)).css({display:'block'}).animate({opacity:1},1000);
			$('#imgsmallslide'+oldi).removeClass('active').addClass('opa05 cursor_poiter',1000);	
			$('#imgbigslide'+oldi).animate({opacity:0},1000);	
			if(oldi<=1) $('#leftclick').hide();
			$('#boximgsmall').animate({left:'+=92px'});	
			$('#rightclick').show();
		}
		oldi=oldi-1;	
	}
</script>
<div class="fl w660">
  <h1 class="orange item ff_museo700 mgb0 txt_indent20">Flights Search Result</h1>
  <div class="item bder_d5 txt_indent20 pdt5 pdb5">Sort by&nbsp;&nbsp;
    <select class="f11 gray bder_d5" id="sortby">
      <option value="timedeparture">Departure time</option>
      <option value="timearrive">Arrive time</option>
      <option value="duration">Duration</option>
    </select>
    <script>
		
		var postdata={departfrom:'<?php echo $_GET['departfrom']?>',arriveto:'<?php echo $_GET['arriveto']?>',adult:'<?php echo $_GET['adult']?>',child:'<?php echo $_GET['child']?>',departuredate:'<?php echo $_GET['departuredate']?>',returningdate:'<?php echo $_GET['returningdate']?>'<?php if(isset($_GET['airline'])){?>,airline:'<?php echo $_GET['airline'] ?>'<?php }?>,oneway:'<?php echo $_GET['oneway']?>'<?php if(isset($_GET['sortby'])){?>,sortby:'<?php echo $_GET['sortby'] ?>'<?php }?><?php if(isset($_GET['price'])){?>,price:'<?php echo $_GET['price'] ?>'<?php }?>};		
    	$('#sortby').on("change",function(){
			postdata.sortby=$('#sortby').val();
			$.get("<?php echo base_url();?>home/ajax/ajax_flight_search_roundtrip",postdata,function(data){
				document.getElementById('box_ajaxflight').innerHTML=data;		
			});							  
		})
    </script>
    <div class="fr w155 pdr14 txt_center">Price</div>
    <div class="fr w73 txt_center">Duration</div>
    <div class="fr w72 txt_center">Stop</div>
    <div class="fr w63 txt_center">Arrival</div>
    <div class="fr pdr4 txt_center">Departure</div>
  </div>
  <div class="item" id="box_ajaxflight">
    <?php if(count($data)>0){
  	foreach($data as $k=>$list){?>
    <table cellspacing="0" cellpadding="0" class="bder-clp mgt5">
      <tbody>
        <tr>
          <td class="w225 bder_d5 bder-l0 pdt6 pdb10 f13"><img width="95" height="55" class="fl pdr10" title="<?php echo "Best of Myanmar - ".$list['destination'] ?>" alt="<?php echo "Best of Myanmar - ".$list['destination'] ?>" src="<?php echo base_url()."uploads/flight/".$list['avatar'] ?>">
            <p class="blue mgt0 mgb0"><?php echo $list['description']; ?></p></td>
          <td class="w90 bder_d5 f11 txt_center"><?php if($_GET['arriveto']==1) echo 'Nyaung-U(Bagan)';
		  													else if($_GET['arriveto']==2) echo 'Heho(Inle)';
															else if($_GET['arriveto']==3) echo 'Mandalay';
															else if($_GET['arriveto']==4) echo 'Yangon';?>
            <br>
            <strong class="f13">
            <?php if($_GET['arriveto']==1) echo 'NYU';
									else if($_GET['arriveto']==2) echo 'HEH';
									else if($_GET['arriveto']==3) echo 'MDL';
									else if($_GET['arriveto']==4) echo 'YGN';?>
            <?php echo date('H:i',strtotime($list['timedeparture'])) ?> </strong></td>
          <td class="w72 bder_d5 f11 txt_center"><?php if($_GET['departfrom']==1) echo 'Nyaung-U(Bagan)';
		  													else if($_GET['departfrom']==2) echo 'Heho(Inle)';
															else if($_GET['departfrom']==3) echo 'Mandalay';
															else if($_GET['departfrom']==4) echo 'Yangon';?>
            <br>
            <strong class="f12">
            <?php if($_GET['departfrom']==1) echo 'NYU';
									else if($_GET['departfrom']==2) echo 'HEH';
									else if($_GET['departfrom']==3) echo 'MDL';
									else if($_GET['departfrom']==4) echo 'YGN';?>
            <?php echo date("H:i",strtotime($list['timearrive'])) ?></strong></td>
          <td class="w72 txt_center bder_d5 f11 lheight20"><strong class="f13">
            <?php if($list['stop']==0) echo "Non-Stop"; else echo "1 Stop";?>
            </strong><br />
            <a class="blue f11 ff_museo500 undeline" href="javascript:void(0);" onClick="showbox('boxshoworhide<?php echo $k ?>');">Details</a></td>
          <td class="w72 txt_center bder_d5 f11"><strong class="f13"><?php echo $list['duration']; ?></strong></td>
          <td class="w170 txt_center bder_d5 f18 orange ff_museo700 lheight27 bder-r0">$<?php echo $list['priceofadult'] ?><br />
            <a href="javascript:void(0);" class="ff_museo500 f14 bgr_143167 white pd4 mgt4" onclick="BookFlight_RoundTrip(<?php echo $list['id'] ?>,<?php echo $_GET['oneway'] ?>,'<?php echo $_GET['departfrom']?>','<?php echo $_GET['arriveto']?>','<?php echo $_GET['adult']?>','<?php echo $_GET['child']?>','<?php echo $_GET['departuredate']?>','<?php echo $_GET['returningdate']?>');">BOOK</a></td>
        </tr>
      </tbody>
    </table>
    <div class="item bgr_gray pdt16 black lheight17 pdb15 hide" id="boxshoworhide<?php echo $k ?>">
      <div class="fl  pdl20 w332 bold">
        <?php if($list['airline']==1)echo "Air Bagan";
		  		else if($list['airline']==2)echo "Air Mandalay"; 
                else if($list['airline']==3)echo "Air KBZ"; 
                else if($list['airline']==4)echo "Myanmar Airways"; 
                else if($list['airline']==5)echo "Yangon Airways";
				else if($list['airline']==6)echo "Asian wings";?>
        <?php echo ' '.$list['codeofairline'] ?><br>
        <?php echo $list['type'] ?> </div>
      <div class="fr w273 pdr20 bold"> <?php echo date('D.F.j',strtotime($list['timedeparture'])) ?><br>
        <?php if($list['fromplace']=="Nyaung-U (Bagan)") echo "Nyaung-U (NYU)";
					else if($list['fromplace']=="Heho (Inle)") echo "Heho (HEH)";
					else if($list['fromplace']=="Mandalay") echo "Mandalay (MDL)";
					else if($list['fromplace']=="Yangon") echo "Yangon (YGN)";?>
        to
        <?php if($list['destination']=="Nyaung-U (Bagan)") echo "Nyaung-U (NYU)";
					else if($list['destination']=="Heho (Inle)") echo "Heho (HEH)";
					else if($list['destination']=="Mandalay") echo "Mandalay (MDL)";
					else if($list['destination']=="Yangon") echo "Yangon (YGN)";?>
      </div>
    </div>
    <?php }	  
  }?>
  </div>
  <div class="item pdt16 pdb16">
    <div class="fr"> <a class="bder_d5 fl pdt4 pdb4 pdl7 pdr9 mgl5" href="#"><img width="10" height="15" class="fl" src="<?php echo base_url(); ?>public/images/arrow_01.jpg"></a><a class="bder_d5 fl pdt4 pdb4 txt_center w24 mgl5 black" href="#">1</a> <a class="bder_d5 fl pdt4 pdb4 txt_center w24 mgl5 black" href="#">2</a> <a class="bder_d5 fl pdt4 pdb4 txt_center w24 mgl5 black" href="#">3</a> <a class="bder_d5 fl pdt4 pdb4 txt_center w24 mgl5 black" href="#">4</a> <a class="bder_d5 fl pdt4 pdb4 txt_center w24 mgl5 black" href="#">5</a> <a class="bder_d5 fl pdt4 pdb4 txt_center w24 mgl5 black" href="#">6</a> <a class="bder_d5 fl pdt4 pdb4 txt_center w24 mgl5 black" href="#">...</a> <a class="bder_d5 fl pdt4 pdb4 txt_center w24 mgl5 black" href="#">10</a> <a class="bder_d5 fl pdt4 pdb4 pdl9 pdr7 mgl5" href="#"><img width="10" height="15" class="fl" src="<?php echo base_url(); ?>public/images/arrow_03.png"></a> </div>
  </div>
  <?php $this->load->view("usercontrol/suggestions");?>
</div>
<div class="fr w193 pdt10">
  <div class="item bgr_gray pdt10">
    <div class="fl pdl10 w173">
      <h3 class="blue ff_museo500 item mgt0 mgb0"><span class="fl">Refine your search&nbsp;</span><img width="20" height="20" class="fl" src="<?php echo base_url(); ?>public/images/iconsearch.png"></h3>
      <h3 class="bgr_orange white txt_indent10 ff_museo700 item pdt6 pdb5 mgt8 mgb3 lighter">Airlines</h3>
      <div class="item pdt4">
        <input type="radio" value="0" name="airline" id="airline0" class="fl mgl10 mgt1" checked="checked" onclick="search_flight('0');"/>
        <label for="airline0">All</label>
      </div>
      <div class="item">
        <input type="radio" value="1" name="airline"  id="airline1" class="fl mgl10 mgt1" onclick="search_flight('1');"/>
        <label for="airline1">Air Bagan</label>
      </div>
      <div class="item">
        <input type="radio" value="2" name="airline" id="airline2" class="fl mgl10 mgt1" onclick="search_flight('2');"/>
        <label for="airline2">Air Mandalay</label>
      </div>
      <div class="item">
        <input type="radio" value="3" name="airline" id="airline3" class="fl mgl10 mgt1" onclick="search_flight('3');"/>
        <label for="airline3">Air KBZ</label>
      </div>
      <div class="item">
        <input type="radio" value="4" name="airline" id="airline4" class="fl mgl10 mgt1" onclick="search_flight('4');"/>
        <label for="airline4">Golden Myanmar Airlines</label>
      </div>
      <div class="item">
        <input type="radio" value="5" name="airline" id="airline5" class="fl mgl10 mgt1" onclick="search_flight('5');"/>
        <label for="airline5">Yangon Airways</label>
      </div>
      <div class="item">
        <input type="radio" value="6" name="airline" id="airline6" class="fl mgl10 mgt1" onclick="search_flight('6');"/>
        <label for="airline6">Asian wings</label>
      </div>
      <h3 class="bgr_orange white txt_indent10 ff_museo700 item pdt6 pdb5 mgt13 mgb3 lighter">Price (USD)</h3>
      <div class="item pdt4">
        <input type="checkbox" value="50" id="price1" class="fl mgl10 mgt1" onclick="search_flight('price1');" />
        &lt;50</div>
      <div class="item">
        <input type="checkbox" value="5099" id="price2" class="fl mgl10 mgt1" onclick="search_flight('price2');" />
        50 - 99</div>
      <div class="item">
        <input type="checkbox" value="100149" id="price3" class="fl mgl10 mgt1" onclick="search_flight('price3');" />
        100 - 149</div>
      <div class="item">
        <input type="checkbox" value="150200" id="price4" class="fl mgl10 mgt1" onclick="search_flight('price4');" />
        150 - 200</div>
      <a href="#" class="fl pdl10 blue undeline mgb10 mgt7">Need help for the booking call us</a> </div>
  </div>
  <img width="100%" class="fl mgt5" src="<?php echo base_url(); ?>public/images/rightbanner_03.png"> <img width="100%" class="fl mgt5" src="<?php echo base_url(); ?>public/images/rightbanner_03.png"> </div>
<script>
	$(document).ready(function(){
		$('input:radio[name=airline]')[0].checked = true;
		for(var i=1;i<=6;i++){
			if($('#price'+i).is(':checked')==true){
				$('#price'+i).attr('checked', false);
			}
		}					   
	})
		
	var price=Array();
	<?php if(isset($_GET['price'])){?>
		price.push('<?php echo $_GET['price'];?>');<?php }?>
		
	
	
	function search_flight(number){
		for(var r=1;r<=6;r++){		
			if(number=="price"+r){
				if($('#'+number).is(':checked')==true){
					price.push($('#'+number).val());			
				}else{	
					var check=-1;
					for(var i=0;i<price.length;i++){
						if(price[i]==$('#'+number).val()){
							check=i;						
						}	
					}
					price.splice(check,1);
				}
			}
		}
		postdata.airline=$('#airline'+number).val();
		postdata.sortby=$('#sortby').val();
		postdata.price=price;
		$.get('<?php echo base_url() ?>home/ajax/ajax_flight_search_roundtrip',postdata,function(data){						
			$('#box_ajaxflight').html(data);
		});
	}
</script>
